/*
 * @Author: your name
 * @Date: 2021-01-14 15:05:38
 * @LastEditTime: 2021-01-15 10:26:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \carlist\src\components\CarItem\index.js
 */
import React, { Component } from './node_modules/react';
import {withRouter} from "./node_modules/react-router-dom"
class CarItem extends Component {
    static defaultProps={
        list:[]
    }
    goDetail=(id)=>{
        this.props.history.push("/car/"+id)
    }
    render() {
        let {list} = this.props;
        console.log(list)
        return (
            <div>
               <ul>
                   {
                       list.length&&list.map(v=>{
                           return(
                               <li key={v.SerialID} onClick={()=>{this.goDetail(v.SerialID)}}>
                                   <p>
                                       <img src={require("../../static/nb.png")} data-src={v.Picture}
                                       alt=""/>
                                   </p>
                                   <p>
                                       <span>{v.AliasName}</span>
                                       <span>{v.DealePrice}</span>
                                   </p>
                                   
                               </li>
                           )
                       })
                   }
               </ul>
            </div>
        );
    }
}

export default withRouter(CarItem);